package ru.amse.tsyganov.jumleditor.graphicaleditor;

public class Coordinates {

	private int originX = 0;
	
	private int originY = 0;
	
	private int maxX = 0;
	
	private int maxY = 0;
	
	private int minX = 0;
	
	private int minY = 0;
	
	private int gridSize = 4;
	
	public int fromScreeXToModelX(int x) {
		return ((originX + x) + gridSize / 2) / gridSize * gridSize;
	}
	
	public int fromScreeYToModelY(int y) {
		return ((originY + y) + gridSize / 2) / gridSize * gridSize;
	}
	
	public int fromModelXToScreenX(int x) {
		return x - originX;
	}
	
	public int fromModelYToScreenY(int y) {
		return y - originY;
	}

	public int getOriginX() {
		return originX;
	}

	public void setOriginX(int originX) {
		this.originX = originX;
	}

	public int getOriginY() {
		return originY;
	}

	public void setOriginY(int originY) {
		this.originY = originY;
	}

	public int getMaxX() {
		return maxX;
	}

	public void setMaxX(int maxX) {
		this.maxX = maxX;
	}

	public int getMaxY() {
		return maxY;
	}

	public void setMaxY(int maxY) {
		this.maxY = maxY;
	}

	public int getMinX() {
		return minX;
	}

	public void setMinX(int minX) {
		this.minX = minX;
	}

	public int getMinY() {
		return minY;
	}

	public void setMinY(int minY) {
		this.minY = minY;
	}
}
